home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / Connections.p < prev    next >
Encoding:
Text File  |  1991-04-05  |  6.5 KB  |  239 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {    Connections.p}
  5. {    Pascal Interface to the Connection Manager}
  6. {    }
  7. {    Copyright © Apple Computer, Inc. 1988-90}
  8. {    All rights reserved}
  9. {}
  10. {$IFC UNDEFINED UsingIncludes}
  11. {$SETC UsingIncludes := 0}
  12. {$ENDC}
  13.  
  14.  
  15. unit Connections;
  16. interface
  17.     uses
  18.         Types, OSUtils, AppleTalk, Memory, Script, Packages, Dialogs, CTBUtilities;
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.     const
  38. { current Connection Manager version }
  39.         curCMVersion = 2;
  40.  
  41. { current Connection Manager Environment Record version }
  42.         curConnEnvRecVers = 0;
  43.  
  44. { error codes }
  45.         cmGenericError = -1;
  46.         cmNoErr = 0;
  47.         cmRejected = 1;
  48.         cmFailed = 2;
  49.         cmTimeOut = 3;
  50.         cmNotOpen = 4;
  51.         cmNotClosed = 5;
  52.         cmNoRequestPending = 6;
  53.         cmNotSupported = 7;
  54.         cmNoTools = 8;
  55.         cmUserCancel = 9;
  56.         cmUnknownError = 11;
  57.  
  58. { CMRecFlags / CMChannel}
  59. {    Low word of CMRecFlags is same as CMChannel }
  60.         cmData = $00000001;
  61.         cmCntl = $00000002;
  62.         cmAttn = $00000004;
  63.  
  64.         cmDataNoTimeout = $00000010;
  65.         cmCntlNoTimeout = $00000020;
  66.         cmAttnNoTimeout = $00000040;
  67.  
  68.         cmDataClean = $00000100;
  69.         cmCntlClean = $00000200;
  70.         cmAttnClean = $00000400;
  71.  
  72.                                         {    only for CMRecFlags (not CMChannel) below this point }
  73.         cmNoMenus = $00010000;
  74.         cmQuiet = $00020000;
  75.  
  76. { CMStatFlags}
  77.         cmStatusOpening = $00000001;
  78.         cmStatusOpen = $00000002;
  79.         cmStatusClosing = $00000004;
  80.         cmStatusDataAvail = $00000008;
  81.         cmStatusCntlAvail = $00000010;
  82.         cmStatusAttnAvail = $00000020;
  83.  
  84.         cmStatusDRPend = $00000040;        {data read pending}
  85.         cmStatusDWPend = $00000080;        {data write pending}
  86.         cmStatusCRPend = $00000100;        {cntl read pending}
  87.         cmStatusCWPend = $00000200;        {cntl write pending}
  88.         cmStatusARPend = $00000400;        {attn read pending}
  89.         cmStatusAWPend = $00000800;        {attn write pending}
  90.  
  91.         cmStatusBreakPend = $00001000;
  92.         cmStatusListenPend = $00002000;
  93.         cmStatusIncomingCallPresent = $00004000;
  94.  
  95.         cmStatusReserved0 = $00008000;
  96.  
  97. { CMSearchFlags}
  98.         cmSearchSevenBit = $0001;
  99.  
  100. { CMFlags}
  101.         cmFlagsEOM = $0001;
  102.  
  103.     type
  104.         CMErr = OSErr;
  105.  
  106.         CMBufFields = (cmDataIn, cmDataOut, 
  107.  
  108.             cmCntlIn, cmCntlOut, 
  109.  
  110.             cmAttnIn, cmAttnOut, 
  111.  
  112.             cmRsrvIn, cmRsrvOut);
  113.  
  114.         CMBuffers = array[CMBufFields] of Ptr;
  115.         CMBufferSizes = array[CMBufFields] of LONGINT;
  116.  
  117.         CMStatFlags = LONGINT;
  118.         CMRecFlags = LONGINT;
  119.         CMChannel = INTEGER;
  120.         CMSearchFlags = INTEGER;
  121.         CMFlags = INTEGER;
  122.  
  123.         ConnEnvironRecPtr = ^ConnEnvironRec;
  124.         ConnEnvironRec = record
  125.                 version: INTEGER;
  126.                 baudRate: LONGINT;
  127.                 dataBits: INTEGER;
  128.                 channels: CMChannel;
  129.                 swFlowControl: BOOLEAN;
  130.                 hwFlowControl: BOOLEAN;
  131.                 flags: CMFlags;
  132.             end;
  133.  
  134.         ConnHandle = ^ConnPtr;
  135.         ConnPtr = ^ConnRecord;
  136.         ConnRecord = record
  137.                 procID: INTEGER;
  138.  
  139.                 flags: CMRecFlags;
  140.                 errCode: CMErr;
  141.  
  142.                 refCon: LONGINT;
  143.                 userData: LONGINT;
  144.  
  145.                 defProc: ProcPtr;
  146.  
  147.                 config: Ptr;
  148.                 oldConfig: Ptr;
  149.  
  150.                 asyncEOM: LONGINT;
  151.  
  152.                 reserved1: LONGINT;
  153.                 reserved2: LONGINT;
  154.  
  155.                 cmPrivate: Ptr;
  156.  
  157.                 bufferArray: CMBuffers;
  158.                 bufSizes: CMBufferSizes;
  159.  
  160.                 mluField: LONGINT;
  161.  
  162.                 asyncCount: CMBufferSizes;
  163.             end;
  164.  
  165.  
  166.  
  167.     function InitCM: CMErr;
  168.     function CMGetVersion (hConn: ConnHandle): Handle;
  169.     function CMGetCMVersion: INTEGER;
  170.  
  171.     function CMNew (procID: INTEGER; flags: CMRecFlags; desiredSizes: CMBufferSizes; refCon: LONGINT; userData: LONGINT): ConnHandle;
  172.     procedure CMDispose (hConn: ConnHandle);
  173.  
  174.     function CMListen (hConn: ConnHandle; async: BOOLEAN; completor: ProcPTr; timeout: LONGINT): CMErr;
  175.     function CMAccept (hConn: ConnHandle; accept: BOOLEAN): CMErr;
  176.  
  177.     function CMOpen (hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; timeout: LONGINT): CMErr;
  178.     function CMClose (hConn: ConnHandle; async: BOOLEAN; completor: ProcPtr; timeout: LONGINT; now: BOOLEAN): CMErr;
  179.  
  180.     function CMAbort (hConn: ConnHandle): CMErr;
  181.  
  182.     function CMStatus (hConn: ConnHandle; var sizes: CMBufferSizes; var flags: CMStatFlags): CMErr;
  183.     procedure CMIdle (hConn: ConnHandle);
  184.  
  185.     procedure CMReset (hConn: ConnHandle);
  186.  
  187.     procedure CMBreak (hConn: ConnHandle; duration: LONGINT; async: BOOLEAN; completor: ProcPtr);
  188.  
  189.     function CMRead (hConn: ConnHandle; theBuffer: Ptr; var toRead: LONGINT; theChannel: CMChannel; async: BOOLEAN; completor: ProcPtr; timeout: LONGINT; var flags: CMFlags): CMErr;
  190.     function CMWrite (hConn: ConnHandle; theBuffer: Ptr; var toWrite: LONGINT; theChannel: CMChannel; async: BOOLEAN; completor: ProcPtr; timeout: LONGINT; flags: CMFlags): CMErr;
  191.     function CMIOKill (hConn: ConnHandle; which: INTEGER): CMErr;
  192.  
  193.     procedure CMActivate (hConn: ConnHandle; activate: BOOLEAN);
  194.     procedure CMResume (hConn: ConnHandle; resume: BOOLEAN);
  195.     function CMMenu (hConn: ConnHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  196.  
  197.     function CMValidate (hConn: ConnHandle): BOOLEAN;
  198.     procedure CMDefault (var theConfig: Ptr; procID: INTEGER; allocate: BOOLEAN);
  199.  
  200.     function CMSetupPreflight (procID: INTEGER; var magicCookie: LONGINT): Handle;
  201.     procedure CMSetupSetup (procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr; var magicCookie: LONGINT);
  202.     function CMSetupFilter (procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr; var theEvent: EventRecord; var theItem: INTEGER; var magicCookie: LONGINT): BOOLEAN;
  203.     procedure CMSetupItem (procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr; var theItem: INTEGER; var magicCookie: LONGINT);
  204.     procedure CMSetupCleanup (procID: INTEGER; theConfig: Ptr; count: INTEGER; theDialog: DialogPtr; var magicCookie: LONGINT);
  205.     procedure CMSetupPostflight (procID: INTEGER);
  206.  
  207.     function CMGetConfig (hConn: ConnHandle): Ptr;
  208.     function CMSetConfig (hConn: ConnHandle; thePtr: Ptr): INTEGER;
  209.  
  210.     function CMIntlToEnglish (hConn: ConnHandle; inputPtr: Ptr; var outputPtr: Ptr; language: INTEGER): OSErr;
  211.     function CMEnglishToIntl (hConn: ConnHandle; inputPtr: Ptr; var outputPtr: Ptr; language: INTEGER): OSErr;
  212.  
  213.     function CMAddSearch (hConn: ConnHandle; theString: Str255; flags: CMSearchFlags; callBack: ProcPtr): LONGINT;
  214.     procedure CMRemoveSearch (hConn: ConnHandle; refnum: LONGINT);
  215.     procedure CMClearSearch (hConn: ConnHandle);
  216.  
  217.     function CMGetConnEnvirons (hConn: ConnHandle; var theEnvirons: ConnEnvironRec): CMErr;
  218.  
  219.     function CMChoose (var hConn: ConnHandle; where: Point; idleProc: ProcPtr): INTEGER;
  220.  
  221.     procedure CMEvent (hConn: ConnHandle; theEvent: EventRecord);
  222.  
  223.     procedure CMGetToolName (procID: INTEGER; var name: Str255);
  224.     function CMGetProcID (name: Str255): INTEGER;
  225.  
  226.     procedure CMSetRefCon (hConn: ConnHandle; refCon: LONGINT);
  227.     function CMGetRefCon (hConn: ConnHandle): LONGINT;
  228.  
  229.     procedure CMSetUserData (hConn: ConnHandle; userData: LONGINT);
  230.     function CMGetUserData (hConn: ConnHandle): LONGINT;
  231.  
  232.  
  233.  {UsingConnections}
  234.  
  235.  
  236. implementation
  237. end.
  238.  
  239.